﻿using EcoSystem.Localization;
using Volo.Abp.Authorization.Permissions;
using Volo.Abp.Localization;
using static EcoSystem.Permissions.EcoSystemPermissions;

namespace EcoSystem.Permissions;

public class EcoSystemPermissionDefinitionProvider : PermissionDefinitionProvider
{
    public override void Define(IPermissionDefinitionContext context)
    {
        var group = context.AddGroup(EcoSystemPermissions.GroupName, L("Permission:EcoSystem"));
        group.AddModulePermission(typeof(EcoSystemPermissions.SystemMenu));
        group.AddModulePermission(typeof(EcoSystemPermissions.Dictionary));
        group.AddModulePermission(typeof(EcoSystemPermissions.ConfigCategory));
        group.AddModulePermission(typeof(EcoSystemPermissions.ConfigDefine));
        group.AddModulePermission(typeof(EcoSystemPermissions.ConfigSetting));
        group.AddModulePermission(typeof(EcoSystemPermissions.TakeConfig));
        group.AddModulePermission(typeof(EcoSystemPermissions.SystemUser));
        group.AddModulePermission(typeof(EcoSystemPermissions.Enterprise));
        group.AddModulePermission(typeof(EcoSystemPermissions.Organization));
        group.AddModulePermission(typeof(EcoSystemPermissions.DepartmentUser));
        group.AddModulePermission(typeof(EcoSystemPermissions.Region));
        group.AddModulePermission(typeof(EcoSystemPermissions.Bucket));
        group.AddModulePermission(typeof(EcoSystemPermissions.DirResource));
        group.AddModulePermission(typeof(EcoSystemPermissions.FileResource));
        group.AddModulePermission(typeof(EcoSystemPermissions.Attachment));
        group.AddModulePermission(typeof(EcoSystemPermissions.AttachmentConfig));
        group.AddModulePermission(typeof(EcoSystemPermissions.ExpertLibrary));
        group.AddModulePermission(typeof(EcoSystemPermissions.ExpertCatalog));
        group.AddModulePermission(typeof(EcoSystemPermissions.ExpertApply));
        group.AddModulePermission(typeof(EcoSystemPermissions.ExpertInventoryAudit));
        group.AddModulePermission(typeof(EcoSystemPermissions.ExpertExtractTask));
        group.AddModulePermission(typeof(EcoSystemPermissions.ExpertExtractPublicity));
        group.AddModulePermission(typeof(EcoSystemPermissions.ReportCategoryConfig));
        group.AddModulePermission(typeof(EcoSystemPermissions.HttpApiConfig));
        group.AddModulePermission(typeof(EcoSystemPermissions.ReportConfig));
        group.AddModulePermission(typeof(EcoSystemPermissions.StatisticalReport));
    }


    private static LocalizableString L(string name)
    {
        return LocalizableString.Create<EcoSystemResource>(name);
    }
}
